package jmine.tec.datadigester.positional.meta;

import java.util.Collections;
import java.util.SortedSet;
import java.util.TreeSet;

/**
 * Metadata about a type of positional file line
 * 
 * @author lundberg
 */
public class PositionalLineMetadata {

    private final Class<?> beanClass;

    private SortedSet<PositionalFieldMetadata> fields = new TreeSet<PositionalFieldMetadata>();

    /**
     * @param beanClass beanClass
     */
    public PositionalLineMetadata(Class<?> beanClass) {
        this.beanClass = beanClass;
    }

    /**
     * @return bean class
     */
    public Class<?> getBeanClass() {
        return this.beanClass;
    }

    /**
     * @return fields
     */
    public SortedSet<PositionalFieldMetadata> getFields() {
        return Collections.unmodifiableSortedSet(this.fields);
    }

    /**
     * @param field field
     */
    public void addField(PositionalFieldMetadata field) {
        this.fields.add(field);
    }

    /**
     * @param field field
     */
    public void removeField(PositionalFieldMetadata field) {
        this.fields.remove(field);
    }
}
